/**
 * @file opration.h
 * @brief   
 * @author  xiaowine (xiaowine@sina.cn)
 * @version 01.00
 * @date    2020-12-10
 * 
 * @copyright Copyright (c) {2020}  xiaowine
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2020-12-10 <td>1.0     <td>wangh     <td>内容
 * </table>
 * ******************************************************************
 * *                   .::::
 * *                 .::::::::
 * *                ::::::::::
 * *             ..:::::::::::
 * *          '::::::::::::
 * *            .:::::::::
 * *       '::::::::::::::..        女神助攻,流量冲天
 * *            ..::::::::::::.     永不宕机,代码无bug
 * *          ``:::::::::::::::
 * *           ::::``:::::::::'        .:::
 * *          ::::'   ':::::'       .::::::::
 * *        .::::'      ::::     .:::::::'::::
 * *       .:::'       :::::  .:::::::::' ':::::
 * *      .::'        :::::.:::::::::'      ':::::
 * *     .::'         ::::::::::::::'         ``::::
 * * ...:::           ::::::::::::'              ``::
 * *```` ':.          ':::::::::'                  ::::.
 * *                   '.:::::'                    ':'````.
 * ******************************************************************
 */
#ifndef __OPRATION_H
#define __OPRATION_H
#include "bsp.h"
/**
	****************************************************************************
	* @Warning 本程序未经作者许可，不得用于其它任何用途 
	* @File    系统参数文件
	* @Author  xiaowine@cee0.com
	* @date    修改日期:2015年3月14日14:53:30
	* @version V1.0
	*************************************************
	* @brief   -->>include struct files
	****************************************************************************
	* @attention 
	* Powered By Xiaowine
	* <h2><center>&copy;  Copyright(C) 小酒论坛 2015-2019</center></h2>
	* All rights reserved
	* 
**/
/*************地址声明**************/

enum
{
    HEATKETTLE = 0,
    STIRRER = 1,
    DELIVEPIPO = 2,
    INFRARED = 3,
};
extern _uFLAG modbusFlag;
#define MODReadFlag modbusFlag.Bits.bit0
#define MODWriteFlag modbusFlag.Bits.bit1
#define EEpExistFlag modbusFlag.Bits.bit2
#define DataNeedRefreshFlag modbusFlag.Bits.bit3
#define DataTransFlag modbusFlag.Bits.bit4
#define HMIOnLineFlag modbusFlag.Bits.bit5
#define SensorOnLineFlag modbusFlag.Bits.bit6

extern ClkFg HIMReadClk;
extern ClkFg HIMWriteClk;
extern ClkFg HIMConnectFlashClk;
extern ClkFg SensorConnectFlashClk;
extern ClkFg ADCCaculateClk;

#define DEFAULT_START_TEMP 100 //默认值 启动温度 ×0.1 ℃
#define DEFAULT_STOP_TEMP 500  //默认值 停止温度×0.1 ℃
#define DEFAULT_WARN_TEMP 800  //默认值 告警温度×0.1 ℃

#define DEFAULT_ON_RANGE 10  //默认值 开时间 s
#define DEFAULT_OFF_RANGE 10 //默认值 关时间 s

typedef struct
{
    u16 tempretureStart[5];
    u16 tempretureStop[5];
    u16 tempretureWarn[5];

    u16 heaterOnRange[4];
    u16 heaterOffRange[4];
} opration_t;
extern opration_t optData;
extern u16 tempreture[5];

extern u16 HimCommunicationCount;
extern u16 SensorCommunicationCount;
extern u16 timerCount;
extern u16 heaterZoneCount[4];
/*************本地函数声明**************/
void ReadHIM(void);
void WriteHIM(void);
void SendCan(void);
void TimeOutOpration(void);
void OprateCanRec(CanRxMsg *RecCache);
void readDataEeData(void);
void writeDataEeData(void);

#endif
